﻿package com.ghost.utils
{
	import com.ghost.model.Global_data;
	
	import flash.errors.EOFError;
	import flash.utils.ByteArray;
	import flash.utils.Endian;

	/**
	 * 处理bytes 
	 * @author ghost
	 */	
    public class BytesUtil extends Object
    {
        public function BytesUtil()
        {
            return;
        }
        public static function creatByteArray():ByteArray
        {
            var bytes:ByteArray = new ByteArray();
			bytes.endian = Endian.LITTLE_ENDIAN;
            return bytes;
        }
		public static function read_bytes(bytes:ByteArray,func:Function):void
		{
			try
			{
				if(func!=null)func(bytes);
			}
			catch(e:EOFError)
			{
				Global_data.show_game_des.show("rec_data is wrong!");
			}
		}
    }
}
